package config

import "log"

const filename = "config.yml"

type Db struct {
	Engine       string
	Host         string
	Port         int
	User         string
	Password     string
	Database     string
	Prefix       string
	Charset      string
	MaxIdleConns int
	MaxOpenConns int
}

type Config struct {
	Db Db
}

func NewConfig() *Config {
	config, err := ReadConfig(filename)
	if err != nil {
		log.Fatalf("read Config failed: %v\n", err)
	}
	return config
}

func ReadConfig(filename string) (*Config, error) {
	config := &Config{}
	// todo: read file
	return config, nil
}
